import request from '@/config/axios'

// 话术库 VO
export interface ScriptVO {
  id: number // 话术id
  name: string // 话术名称
  info: string // 话术内容
  isReply: number // 回答方式
  scriptType: number // 话术类型
  remark: string // 备注
}

// 话术库 API
export const ScriptApi = {
  // 查询话术库分页
  getScriptPage: async (params: any) => {
    return await request.get({ url: `/system/script/page`, params })
  },

  // 查询话术库详情
  getScript: async (id: number) => {
    return await request.get({ url: `/system/script/get?id=` + id })
  },

  // 新增话术库
  createScript: async (data: ScriptVO) => {
    return await request.post({ url: `/system/script/create`, data })
  },

  // 修改话术库
  updateScript: async (data: ScriptVO) => {
    return await request.put({ url: `/system/script/update`, data })
  },

  // 删除话术库
  deleteScript: async (id: number) => {
    return await request.delete({ url: `/system/script/delete?id=` + id })
  },

  // 导出话术库 Excel
  exportScript: async (params) => {
    return await request.download({ url: `/system/script/export-excel`, params })
  },
}